package jtk.project4.fleet.field;

import java.util.List;

import jtk.project4.fleet.domain.Vendor;
//import jtk.project4.fleet.model.VendorModel;
//import jtk.project4.fleet.FleetModel;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.TextField;


public class AddVendorField extends GroupControl<Vendor> {
//private VendorModel model;
//private FleetModel fleetModel;
private TextField nameField;
private TextField contactField;
private TextField address1Field;
private TextField address2Field;
private TextField cityField;
private TextField stateprovinceField;
private TextField postalcodeField;
private TextField countryField;
private TextField phone1Field;
private TextField phone2Field;
private TextField faxField;
private TextField emailField;
private ComboField<String> typeField;
private ComboField<String> termField;
private TextField websiteField;
private TextField commentsField;

	public AddVendorField(String bindID){
		//model = new VendorModel();
		setTitle("header.AddVendor");
		setBindID(bindID);
		createFields();
		createLayout();
		}
	private void createFields(){
		
		/*IssueDateField = new CalendarControl("IssueDate","20")
		 IssueDateField.setFormat (new SimpleDateFormat("Date.Format"))
		 IssueDateField.showYearSpinner(true);*/
		
		nameField = new TextField ("name", 20);
		nameField.setRequired(true);
		
		contactField = new TextField ("contact", 20);
		
		
		address1Field = new TextField ("address1", 20);
		
		
		address2Field = new TextField ("address2", 20);
		
		
		cityField = new TextField ("city", 20);
		
		
		stateprovinceField = new TextField ("stateProvince", 20);
		
		
		postalcodeField = new TextField ("postalCode", 20);
		
		
		countryField = new TextField ("country", 20);
		
		
		phone1Field = new TextField ("phone1", 20);
		
		
		phone2Field = new TextField ("phone2", 20);
		
		
		faxField = new TextField ("fax", 20);
		
		
		emailField = new TextField ("email", 20);
		
		typeField = new ComboField<String> ("typess","typess");
		typeField.setPreferredSize(emailField.getPreferredSize());
		
		termField = new ComboField<String> ("termss","termss");
		termField.setPreferredSize(emailField.getPreferredSize());
		//typeField = new TextField("type", 20);
		
		//termField = new TextField("terms", 20);		
		
		websiteField = new TextField ("website", 20);
		
		
		commentsField = new TextField ("comments", 20);
		
	}
	private void createLayout(){
			setLayout(new FormLayout())
			.addLabel("label.name").addField(nameField)
			.addRow()
			.addLabel("label.contact").addField(contactField)
			.addRow()
			.addLabel("label.address1").addField(address1Field)
			.addRow()
			.addLabel("label.address2").addField(address2Field)
			.addRow()
			.addLabel("label.city").addField(cityField)
			.addRow()
			.addLabel("label.stateprovince").addField(stateprovinceField)
			.addRow()
			.addLabel("label.postalcode").addField(postalcodeField)
			.addRow()
			.addLabel("label.country").addField(countryField)
			.addRow()
			.addLabel("label.phone1").addField(phone1Field)
			.addRow()
			.addLabel("label.phone2").addField(phone2Field)
			.addRow()
			.addLabel("label.fax").addField(faxField)
			.addRow()
			.addLabel("label.email").addField(emailField)
			.addRow()
			.addLabel("label.type").addField(typeField)
			.addRow()
			.addLabel("label.term").addField(termField)
			.addRow()
			.addLabel("label.website").addField(websiteField)
			.addRow()
			.addLabel("label.comments").addField(commentsField)
			.addRow()
			;
		}

}

